home *** CD-ROM | disk | FTP | other *** search
- Path: pacifica.access.ch!usenet
- From: tombeck@usemail.com (Thomas Beck)
- Newsgroups: comp.lang.c++
- Subject: Re: Please please help a newbie!
- Date: 16 Feb 1996 23:36:24 GMT
- Organization: Internet Access AG, Zuerich, Switzerland
- Message-ID: <4g34do$mg0@pacifica.access.ch>
- References: <4ftoe8$5a2@pacifica.access.ch>
- NNTP-Posting-Host: gatezh2-16.access.ch
- X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
-
- In message <3124EEF1.3234@bnr.ca> - Mike Alexander <mikealex@bnr.ca> writes:
-
- >> ----------- example 2: -------------
- >> struct abc {
- >> int i;
- >> char a;
- >> void f1() {
- >> };
- >> };
- >>
- >> main() {
- >> }
- >> ---------------------------------------------
- >
- >I'm not a 100% sure what you are trying to do here, but I think
- >you are trying to define a class with f1() being an inline function.
- >If I'm right, then you should be defining abc to be a class, not a
- >struct. You're code would look like:
- >
- > class abc {
- > int i;
- > char a;
- > void f1() {} // <-- note, the ; after this closing
- > // closing brace is optional
- > };
- >
-
- Hm, the way I learnt it, struct and class are equal except for the fact that
- the default state in a class is private whereas it is public in a struct.
- So...
-
- class abc { should be equal to struct abc {
- private: private:
- stuff... stuff....
- public: public:
- stuff... stuff....
- } }
-
- Am I wrong?
-
- >Some of this may be a little more than you have gotten too in your
- >book though (such as constructors, destructors, and automatic
- >initializers).
-
- I've learned it today :-)
-
- Thomas Beck, tombeck@usemail.com
-
- =================================================================
- Summer's day, as she passed away. Birds were singing in the
- summer sky; then came the rain, and once again, a tear fell
- from her mother's eye...
- =================================================================
-
-